package com.heart.house.api.config;

import com.netflix.client.config.IClientConfig;
import com.netflix.loadbalancer.AvailabilityFilteringRule;
import com.netflix.loadbalancer.IRule;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;

/**
 * @author Luo Zhen
 * @create 2019-10-29 16:15
 */

public class NewRuleConfig {

    @Autowired
    private IClientConfig ribbonClientConfig;


    /**
     * 每过10秒心跳检查  服务提供方的实例是否存货
     *
     * @param config
     * @return
     */
//    @Bean
//    public IPing ribbonPing(IClientConfig config) {
//        return new PingUrl(false, "/health");
//    }

    @Bean
    public IRule ribbonRule(IClientConfig config) {
        // new RandomRule(); 随机
        return new AvailabilityFilteringRule();
    }
}
